/*
 ***************************************************************************
 * MediaTeK Inc.
 * 4F, No. 2 Technology	5th	Rd.
 * Science-based Industrial	Park
 * Hsin-chu, Taiwan, R.O.C.
 *
 * (c) Copyright 2002-2012, MTK.
 *
 * All rights reserved.	MediaTeK's source	code is	an unpublished work	and	the
 * use of a	copyright notice does not imply	otherwise. This	source code
 * contains	confidential trade secret material of MediaTeK Tech. Any attemp
 * or participation	in deciphering,	decoding, reverse engineering or in	any
 * way altering	the	source code	is stricitly prohibited, unless	the	prior
 * written consent of MediaTeK, Inc. is obtained.
 ***************************************************************************

	Module Name:
	omci_lib_internal.h

	Abstract:

	Revision History:
	Who			When			What
	--------	----------		----------------------------------------------
	Name		Date			Modification logs
	Xi.Wang		2018/9/5	Create
*/

#ifndef _OMCI_LIB_INTERNAL_H_
#define _OMCI_LIB_INTERNAL_H_
#include "omci_lib_external.h"


#define CONDITION_CFG_DONE	(1 << 0)
#define CONDITION_ONU_READY	(1 << 1)
#define CONDITION_RE_CONFIG	(1 << 2)

/**debug level ***/
#define OMCI_LIB_DEBUG_LEVEL_NO_MSG		0
#define OMCI_LIB_DEBUG_LEVEL_ERROR		1
#define OMCI_LIB_DEBUG_LEVEL_WARN		2
#define OMCI_LIB_DEBUG_LEVEL_TRACE		3
#define OMCI_LIB_DEBUG_LEVEL_DEBUG		4

/* AES definition & structure */
#define AES_STATE_ROWS 4     /* Block size: 4*4*8 = 128 bits */
#define AES_STATE_COLUMNS 4
#define AES_BLOCK_SIZES AES_STATE_ROWS*AES_STATE_COLUMNS
#define AES_KEY_ROWS 4
#define AES_KEY_COLUMNS 8    /*Key length: 4*{4,6,8}*8 = 128, 192, 256 bits */
#define AES_KEY128_LENGTH 16
#define AES_KEY192_LENGTH 24
#define AES_KEY256_LENGTH 32

typedef struct {
    uint8_t State[AES_STATE_ROWS][AES_STATE_COLUMNS];
    uint8_t KeyWordExpansion[AES_KEY_ROWS][AES_KEY_ROWS*((AES_KEY256_LENGTH >> 2) + 6 + 1)];
} AES_CTX_STRUC, *PAES_CTX_STRUC;

typedef struct CompileOp_s{
	unsigned char tcsupport_hgu_omci_mib_upload_pptp_eth_uni;
}CompileOp_t, *CompileOp_p;

void omci_lib_dbg_printf(uint8_t debugLevel, char *fmt,...);

/*Debug Level*/
/******************************************************************************
 Descriptor:    It's used to set omci dbg level.
 Input Args:    DebugLevel:
			   #define OMCI_DEBUG_LEVEL_NO_MSG		0
			   #define OMCI_DEBUG_LEVEL_ERROR		1
			   #define OMCI_DEBUG_LEVEL_WARN		2
			   #define OMCI_DEBUG_LEVEL_TRACE		3
			   #define OMCI_DEBUG_LEVEL_DEBUG		4
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_omci_dbg_level(unsigned char DebugLevel);

/******************************************************************************
 Descriptor:    It's used to get omci dbg level.
 Input Args:    DebugLevel: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_omci_dbg_level(unsigned char *DebugLevel);

/******************************************************************************
 Descriptor:    It's used to set omci lib dbg level.
 Input Args:    DebugLevel:
			   #define OMCI_DEBUG_LEVEL_NO_MSG		0
			   #define OMCI_DEBUG_LEVEL_ERROR		1
			   #define OMCI_DEBUG_LEVEL_WARN		2
			   #define OMCI_DEBUG_LEVEL_TRACE		3
			   #define OMCI_DEBUG_LEVEL_DEBUG		4
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_omci_lib_dbg_level(unsigned char DebugLevel);

/******************************************************************************
 Descriptor:    It's used to get omci lib dbg level.
 Input Args:    *DebugLevel:
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_omci_lib_dbg_level(unsigned char *DebugLevel);

/******************************************************************************
 Descriptor:    It's used to set onuType.
 Input Args:    onuType: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_onu_type_mem(unsigned char onuType);

/******************************************************************************
 Descriptor:    It's used to set LanDebug.
 Input Args:    LanDebug: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_lan_debug(unsigned char LanDebug);

/******************************************************************************
 Descriptor:    It's used to get LanDebug.
 Input Args:    LanDebug: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_lan_debug(unsigned char *LanDebug);
/*ONU Capability*/
/******************************************************************************
 Descriptor:    It's used to set ONU version.
 Input Args:    version: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_onu_version(char *onu_ver);

/******************************************************************************
 Descriptor:    It's used to get ONU version.
 Input Args:    version: char pointer,size:the size of version buffer,it must be no less than OMCI_VERSION_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_onu_version(char *onu_ver, unsigned int size);

/******************************************************************************
 Descriptor:    It's used to set vendor ID.
 Input Args:    VendorId: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_vendor_id(char *VendorId);

/******************************************************************************
 Descriptor:    It's used to get vendor ID.
 Input Args:    VendorId: char pointer,size:the size of VendorId buffer,it must be no less than OMCI_VENDOR_ID_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_vendor_id(char *VendorId, unsigned int size);

/******************************************************************************
 Descriptor:    It's used to set equipmentId.
 Input Args:    equipmentId: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_equipment_id(char *equipmentId);

/******************************************************************************
 Descriptor:    It's used to get equipmentId.
 Input Args:    equipmentId: char pointer,size:the size of equipmentId buffer,it must be no less than OMCI_EQUIPMENTID_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_equipment_id(char *equipmentId, unsigned int size);

/******************************************************************************
 Descriptor:    It's used to set operatorID_cap.
 Input Args:    operatorID_cap: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_operator_id_cap(char *operatorID_cap);

/******************************************************************************
 Descriptor:    It's used to get operatorID_cap.
 Input Args:    operatorID_cap: char pointer,size:the size of operatorID_cap buffer,it must be no less than OMCI_OPERATOR_ID_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_operator_id_cap(char *operatorID_cap, unsigned int size);

/******************************************************************************
 Descriptor:    It's used to set operatorID_auth.
 Input Args:    operatorID_auth: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_operator_id_auth(char *operatorID_auth);

/******************************************************************************
 Descriptor:    It's used to get operatorID_auth.
 Input Args:    operatorID_auth: char pointer,size:the size of operatorID_auth buffer,it must be no less than OMCI_OPERATOR_ID_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_operator_id_auth(char *operatorID_auth, unsigned int size);

/******************************************************************************
 Descriptor:    It's used to set Loid.
 Input Args:    LOID: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_loid(char *Loid);

/******************************************************************************
 Descriptor:    It's used to get LOID.
 Input Args:    LOID: char pointer,size:the size of Loid buffer,it must be no less than OMCI_LOID_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_loid(char *Loid, unsigned int size);
/******************************************************************************
 Descriptor:    It's used to set olt type.
 Input Args:    LOID: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_olt_type(char *Loid);

/******************************************************************************
 Descriptor:    It's used to get olt type.
 Input Args:    LOID: char pointer,size:the size of Loid buffer,it must be no less than OMCI_OLT_TYPE_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_olt_type(char *Loid, unsigned int size);


/******************************************************************************
 Descriptor:    It's used to set LOID_Password.
 Input Args:    LOID_Password: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_loid_password(char *LOID_Password); 

/******************************************************************************
 Descriptor:    It's used to get LOID_Password.
 Input Args:    LOID_Password: char pointer,size:the size of LOID_Password buffer,it must be no less than OMCI_LOID_PASSWORD_LENS.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_loid_password(char *LOID_Password, unsigned int size);
/******************************************************************************
 Descriptor:    It's used to use tcapi command set ONU enhanced psk.
 Input Args:    enhanced_bsk: char pointer.
 Ret Value: success: ECONET_E_SUCCESS
               fail: ECONET_E_FAIL
******************************************************************************/
int omci_lib_set_cfg_enhanced_psk(unsigned char *cfg_psk);

/******************************************************************************
 Descriptor:    It's used to set ONU enhanced psk.
 Input Args:    enhanced_psk: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_enhanced_psk(unsigned char *enhanced_psk);

/******************************************************************************
 Descriptor:    It's used to get ONU enhanced psk.
 Input Args:    enhanced_psk: char pointer,size:the size of enhanced_psk buffer, it must be no less than PRESHARED_KEY_LEN
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_enhanced_psk(unsigned char *enhanced_psk, unsigned int size);



/******************************************************************************
 Descriptor:    It's used to set linkMode.
 Input Args:    linkMode: char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_link_mode(char linkMode);

/******************************************************************************
 Descriptor:    It's used to get linkMode.
 Input Args:    linkMode: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_link_mode(onu_link_mode_t *linkMode);

/******************************************************************************
 Descriptor:    It's used to set usqMode.
 Input Args:    usqMode: char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_usq_mode(char usQMode);

/******************************************************************************
 Descriptor:    It's used to get usqMode.
 Input Args:    usqMode: char pointer
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_usq_mode(char *usQMode);

/******************************************************************************
 Descriptor:    It's used to set vendorProCode.
 Input Args:    vendorProCode: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_vendor_pro_code(unsigned short vendorProCode);

/******************************************************************************
 Descriptor:    It's used to get vendorProCode.
 Input Args:    vendorProCode: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_vendor_pro_code(unsigned short *vendorProCode);


/******************************************************************************
 Descriptor:    It's used to set omccVersion.
 Input Args:    omccVersion: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_omcc_version(unsigned char omccVersion);

/******************************************************************************
 Descriptor:    It's used to get omccVersion.
 Input Args:    omccVersion: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_omcc_version(unsigned char *omccVersion);


/******************************************************************************
 Descriptor:    It's used to set tmOption.
 Input Args:    tmOption: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_tm_option(unsigned char tmOption);

/******************************************************************************
 Descriptor:    It's used to get tmOption.
 Input Args:    tmOption: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_tm_option(unsigned char *tmOption);


/******************************************************************************
 Descriptor:    It's used to set onuSurvivalTime.
 Input Args:    onuSurvivalTime: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_survival_time(unsigned char onuSurvivalTime);

/******************************************************************************
 Descriptor:    It's used to get onuSurvivalTime.
 Input Args:    onuSurvivalTime: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_survival_time(unsigned char *onuSurvivalTime);


/******************************************************************************
 Descriptor:    It's used to set extendedTcLayer.
 Input Args:    extendedTcLayer: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_extended_tclayer(unsigned char extendedTcLayer);

/******************************************************************************
 Descriptor:    It's used to get extendedTcLayer.
 Input Args:    extendedTcLayer: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_extended_tclayer(unsigned char *extendedTcLayer);


/******************************************************************************
 Descriptor:    It's used to set securityCap.
 Input Args:    securityCap: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_security_cap(unsigned char securityCap);

/******************************************************************************
 Descriptor:    It's used to get securityCap.
 Input Args:    securityCap: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_security_cap(unsigned char *securityCap);

/******************************************************************************
 Descriptor:    It's used to set eventMask.
 Input Args:    eventMask: unsigned int.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_event_mask(unsigned int eventMask);

/******************************************************************************
 Descriptor:    It's used to get eventMask.
 Input Args:    eventMask: unsigned int pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_event_mask(unsigned int *eventMask);


/******************************************************************************
 Descriptor:    It's used to set totalTSNum.
 Input Args:    totalTSNum: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_total_ts_num(unsigned char totalTSNum);

/******************************************************************************
 Descriptor:    It's used to get totalTSNum.
 Input Args:    totalTSNum: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_total_ts_num(unsigned char *totalTSNum);

/******************************************************************************
 Descriptor:    It's used to set totalPQNum.
 Input Args:    totalPQNum: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_total_pq_num(unsigned short totalPQNum);

/******************************************************************************
 Descriptor:    It's used to get totalPQNum.
 Input Args:    totalPQNum: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_total_pq_num(unsigned short *totalPQNum);


/******************************************************************************
 Descriptor:    It's used to set totalGEMPortNum.
 Input Args:    totalGEMPortNum: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_total_gemport_num(unsigned short totalGEMPortNum);

/******************************************************************************
 Descriptor:    It's used to get totalGEMPortNum.
 Input Args:    totalGEMPortNum: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_total_gemport_num(unsigned short *totalGEMPortNum);


/******************************************************************************
 Descriptor:    It's used to set connectivityCap.
 Input Args:    connectivityCap: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_connectivity_cap(unsigned short connectivityCap);

/******************************************************************************
 Descriptor:    It's used to get connectivityCap.
 Input Args:    connectivityCap: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_connectivity_cap(unsigned short *connectivityCap);


/******************************************************************************
 Descriptor:    It's used to set qoSConfFlex.
 Input Args:    qoSConfFlex: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_qos_conf_flex(unsigned short qoSConfFlex);

/******************************************************************************
 Descriptor:    It's used to get qoSConfFlex.
 Input Args:    qoSConfFlex: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_qos_conf_flex(unsigned short *qoSConfFlex);


/******************************************************************************
 Descriptor:    It's used to set VoIPbyTR069.
 Input Args:    VoIPbyTR069: char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_voip_by_tr069(char VoIPbyTR069);

/******************************************************************************
 Descriptor:    It's used to get VoIPbyTR069.
 Input Args:    VoIPbyTR069: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_voip_by_tr069(char *VoIPbyTR069);

/******************************************************************************
 Descriptor:    It's used to set VoIP time separate enable.
 Input Args:    VoIPSepEn: char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_voip_sep_en(char VoIPSepEn);

/******************************************************************************
 Descriptor:    It's used to get VoIP time separate enable.
 Input Args:    VoIPSepEn: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_voip_sep_en(char *VoIPSepEn);

/******************************************************************************
 Descriptor:    It's used to set SpecVersion.
 Input Args:    SpecVersion: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_spec_version(unsigned char SpecVersion);

/******************************************************************************
 Descriptor:    It's used to get SpecVersion.
 Input Args:    SpecVersion: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_spec_version(unsigned char *SpecVersion);


/******************************************************************************
 Descriptor:    It's used to set ONU_PowerCtr.
 Input Args:    ONU_PowerCtr: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_onu_power_ctrl(unsigned char ONU_PowerCtr);

/******************************************************************************
 Descriptor:    It's used to get ONU_PowerCtr.
 Input Args:    ONU_PowerCtr: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_onu_power_ctrl(unsigned char *ONU_PowerCtr);


/******************************************************************************
 Descriptor:    It's used to set AuthStatus.
 Input Args:    AuthStatus: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_auth_status(unsigned char AuthStatus);     

/******************************************************************************
 Descriptor:    It's used to get AuthStatus.
 Input Args:    AuthStatus: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_auth_status(unsigned char *AuthStatus);


/******************************************************************************
 Descriptor:    It's used to set max_ports & port_id.
 Input Args:    max_ports: signed char.
 				port_id: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_max_ports_list(signed char max_ports,int *port_id);

/******************************************************************************
 Descriptor:    It's used to get max ports.
 Input Args:    max_ports: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_max_ports(signed char *max_ports);

/******************************************************************************
 Descriptor:    It's used to get max ports.
 Input Args:    port_id: int array pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_port_list(int *port_id);


/*ANI capability*/
/******************************************************************************
 Descriptor:    It's used to set srIndication.
 Input Args:    srIndication: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_sr_indication(unsigned char srIndication);

/******************************************************************************
 Descriptor:    It's used to get srIndication.
 Input Args:    srIndication: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_sr_indication(unsigned char *srIndication);


/******************************************************************************
 Descriptor:    It's used to set totalTcontNum.
 Input Args:    totalTcontNum: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_total_tcont_num(unsigned short totalTcontNum);

/******************************************************************************
 Descriptor:    It's used to get totalTcontNum.
 Input Args:    totalTcontNum: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_total_tcont_num(unsigned short *totalTcontNum);


/******************************************************************************
 Descriptor:    It's used to set gemBlockLength.
 Input Args:    gemBlockLength: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_gem_block_length(unsigned short gemBlockLength);

/******************************************************************************
 Descriptor:    It's used to get gemBlockLength.
 Input Args:    gemBlockLength: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_gem_block_length(unsigned short *gemBlockLength);


/******************************************************************************
 Descriptor:    It's used to set onuResponseTime.
 Input Args:    onuResponseTime: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_onu_response_time(unsigned short onuResponseTime);

/******************************************************************************
 Descriptor:    It's used to get onuResponseTime.
 Input Args:    onuResponseTime: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_onu_response_time(unsigned short *onuResponseTime);


/******************************************************************************
 Descriptor:    It's used to set conReqPort.
 Input Args:    conReqPort: unsigned short.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_con_req_port(unsigned short conReqPort);

/******************************************************************************
 Descriptor:    It's used to get conReqPort.
 Input Args:    conReqPort: unsigned short pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_con_req_port(unsigned short *conReqPort);


/******************************************************************************
 Descriptor:    It's used to get onuType.
 Input Args:    onuType: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_onu_type_mem(unsigned char *OnuType);


/******************************************************************************
 Descriptor:    It's used to GET Custom Self Define Vendor ID Flag.
 Input Args:    flag: unsigned char porinter.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_self_def_vendorId_flag(unsigned char *flag);
/******************************************************************************
 Descriptor:    It's used to set Custom Self Define Vendor ID flag .
 Input Args:    flag: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_self_def_vendorId_flag(unsigned char flag);
/******************************************************************************
 Descriptor:    It's used to GET strict PPTP ethuni slot Flag.
 Input Args:    flag: unsigned char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_strict_pptp_ethuni_slot_flag(unsigned char *flag);
/******************************************************************************
 Descriptor:    It's used to set strict PPTP ethuni slot flag .
 Input Args:    flag: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_strict_pptp_ethuni_slot_flag(unsigned char flag);
/******************************************************************************
 Descriptor:    It's used to get IPHOST MAC Address.
 Input Args:    mac: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_iphost_mac(unsigned char *mac, unsigned int size);
/******************************************************************************
 Descriptor:    It's used to set IPHOST MAC Address.
 Input Args:    mac: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_iphost_mac(unsigned char *mac);
/******************************************************************************
 Descriptor:    It's used to set IPHOST Instance Number.
 Input Args:    num: unsgined char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_iphost_num(unsigned char num);
/******************************************************************************
 Descriptor:    It's used to get IPHOST Instance Number.
 Input Args:    num: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_iphost_num(unsigned char *num);
/******************************************************************************
 Descriptor:    It's used to get FILE transfer control message.
 Input Args:    fileCtrl: file_transfer_ctrl_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_file_trans_ctrl(file_transfer_ctrl_t* fileCtrl);
/******************************************************************************
 Descriptor:    It's used to set FILE transfer control  message.
 Input Args:    fileCtrl: file_transfer_ctrl_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_file_trans_ctrl(file_transfer_ctrl_t* fileCtrl);
/******************************************************************************
 Descriptor:    It's used to set ONU slot.
 Input Args:    onuSlot: omciOnuSlot_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_onu_slot(omciOnuSlot_t *onuSlot);
/******************************************************************************
 Descriptor:    It's used to get ONU slot.
 Input Args:    onuSlot: omciOnuSlot_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_onu_slot(omciOnuSlot_t *onuSlot);
/******************************************************************************
 Descriptor:    It's used to get FILE transfer control message.
 Input Args:    fileCtrl: file_transfer_ctrl_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_pptp_video_ani_cfg(pptp_video_ani_t *pptpVideoAniCfg);
/******************************************************************************
 Descriptor:    It's used to set FILE transfer control  message.
 Input Args:    fileCtrl: file_transfer_ctrl_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_pptp_video_ani_cfg(pptp_video_ani_t *pptpVideoAniCfg);
/******************************************************************************
 Descriptor:    It's used to get mib data sync init value.
 Input Args:    syncVal: char pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_mib_data_sync_init_val(uint8_t * syncVal);
/******************************************************************************
 Descriptor:    It's used to set mib data sync init value.
 Input Args:    syncVal: char .
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/

int omci_lib_set_mib_data_sync_init_val(uint8_t syncVal);
/******************************************************************************
 Descriptor:    It's used to enable/disable vlan filter data ME config IPHost.
 Input Args:    compileOption: unsigned char.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_set_vlan_filter_iphost_en(char enable);

/******************************************************************************
 Descriptor:    It's used to get if vlan filter data ME can config IPHost .
 Input Args:    timeStatusMsg: time_status_msg_t pointer.
 Ret Value: success: OMCI_LIB_SUCCESS
               fail: OMCI_LIB_FAIL
******************************************************************************/
int omci_lib_get_vlan_filter_iphost_en(char * enable);

int omci_lib_uci_get(char *option, char *value, unsigned int size);
#define oam_lib_uci_get omci_lib_uci_get

int omci_lib_init(void);
int omci_lib_deinit(void);
int omci_lib_get_sn_mem(char *sn, unsigned int size);
int omci_lib_set_sn_mem(unsigned char *psn);
int omci_lib_get_passwd_mem(char *sn, unsigned int size);
int omci_lib_get_regid_mem(char *regid, unsigned int size);
int omci_lib_set_passwd_mem(char *password);
int omci_oam_lib_get_romfile_load_flag(unsigned char *romfile_load_flag);
int omci_oam_lib_set_romfile_load_flag(unsigned char romfile_load_flag);
int omci_lib_get_onu_emergency(unsigned char *EmergencyState);
int omci_lib_set_onu_emergency(unsigned char EmergencyState);
int omci_lib_get_compile_option(CompileOp_t *compileOption);
int omci_lib_set_compile_option(CompileOp_t *compileOption);
int omci_lib_get_omci_attr_default_value(omciAttrDefVal_t *omciAttrDefVal);
int omci_lib_set_omci_attr_default_value(omciAttrDefVal_t *omciAttrDefVal);
int omci_lib_get_time_status_msg(time_status_msg_t *timeStatusMsg);
int omci_lib_set_time_status_msg(time_status_msg_t *timeStatusMsg);
int omci_lib_get_onu_up_AES_mode(unsigned char *mode);
int omci_lib_set_onu_up_AES_mode(unsigned char mode);

void omci_lib_cfg_data_done(void);
int omci_lib_set_omci_fsm_cond_by_bit(uint8_t fsmCondition,uint8_t fsmConditionMask);
int omci_lib_get_omci_fsm_cond(uint8_t *fsmCondition);
int omci_lib_set_sys_up_time(unsigned int SysUpTimeFunc);
int omci_lib_get_sys_up_time(unsigned int *SysUpTimeFunc);
int omci_lib_set_auth_security_meth(auth_security_meth_t *authSecurityMeth);
int omci_lib_get_auth_security_meth(auth_security_meth_t *authSecurityMeth);

/* AES operations */
void RT_AES_KeyExpansion (IN uint8_t Key[], IN uint32_t KeyLength, IN_OUT AES_CTX_STRUC *paes_ctx);

void RT_AES_Encrypt (IN uint8_t PlainBlock[], IN uint32_t PlainBlockSize, IN uint8_t Key[], 
	IN uint32_t KeyLength, OUT uint8_t CipherBlock[], IN_OUT uint32_t *CipherBlockSize);


/* AES-CMAC operations */
void AES_CMAC_GenerateSubKey (IN uint8_t Key[], IN uint32_t KeyLength, OUT uint8_t SubKey1[], OUT uint8_t SubKey2[]);

#endif
